<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>条件渲染</title>
    <script src="js/vue.js"></script>
</head>
<body>
<!--
    v-if,v-else: 移除标签
    v-show: 通过样式隐藏(display: none)
    如果要频繁切换,用v-show较好
-->
<div id="demo">
    <p v-if="ok">成功了</p>
    <p v-else>失败了</p>
    <button @click="ok=!ok">切换</button>
    <p v-show="ok">成了</p>
    <p v-show="!ok">不成</p>
</div>
<script>
    new Vue({
        el: '#demo',
        data: {
            ok: false
        }
    });
</script>
</body>
</html>